<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class login extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function __construct() {
		parent::__construct();
		ini_set('session.cookie_httponly',1); 
		ini_set('session.use_only_cookies',1);	
		$this->load->model('login_class');
	}	 

	public function login_user(){
// 		$post = $this->input->post();
// 		$message = $this->login_class->chk_user_account($post);
// 		$data['message'] = $message;
// 		$data['chk_log'] = $this->session->userdata('user_logged_in');
// 		$data['owner'] = $this->session->userdata('owner');
// 		$data['session_code'] = base64_encode(urlencode("user_id=".$this->session->userdata('intID')));
// 		$data['dateConceptionDate'] = $this->session->userdata('dateConceptionDate');
// 		echo json_encode($data);
		$post = $this->input->post();
		$message = $this->login_class->chk_user_account($post);
		if($message=="Thank you."){
			$data['message'] = $message;
			$data['chk_log'] = $this->session->userdata('user_logged_in');
			$data['owner'] = $this->session->userdata('owner');
			$data['intAccountType'] = $this->session->userdata('intAccountType'); //Mark - Account Type
			$data['strName'] = $this->session->userdata('strName'); //Get Name
			$data['session_code'] = base64_encode(urlencode("user_id=".$this->session->userdata('intID')));
			$data['dateConceptionDate'] = $this->session->userdata('dateConceptionDate');
			$data['strImgLink'] = $this->session->userdata('strImgLink');
		} else {
			$data['message'] = $message;
			$data['chk_log'] = 0;
			$data['owner'] = "";
			$data['intAccountType'] = ""; //Mark - Account Type
			$data['strName'] = ""; //Get Name
			$data['session_code'] = "";
			$data['dateConceptionDate'] = "";
			$data['strImgLink'] = "";
		}

		echo json_encode($data);
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */